﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Globalization;

namespace OpenPhotoAlbum.Controls
{
	public static class GuidUtility
	{
		public static Guid Combine(Guid id1, Guid id2)
		{
			byte[] arr1 = id1.ToByteArray();
			byte[] arr2 = id2.ToByteArray();
			byte[] result = new byte[16];
			for (int i = 0; i < 8; i++) { result[i] = arr1[i]; }
			for (int i = 8; i < 16; i++) { result[i] = arr2[i]; }
			return new Guid(result);
		}

		public static Guid Combine(byte[] arr, Guid id)
		{
			byte[] arr1 = arr;
			byte[] arr2 = id.ToByteArray();
			byte[] result = new byte[16];
			for (int i = 0; i < arr1.Length; i++) { result[i] = arr1[i]; }
			for (int i = arr1.Length; i < 16; i++) { result[i] = arr2[i]; }
			return new Guid(result);
		}

		public static Guid Combine(string str, Guid id)
		{
			byte[] arr = BitConverter.GetBytes(str.GetHashCode());
			return Combine(arr, id);
		}
	}
}
